import { createUrl, http } from "@/utils/http";
import type { PageResult, Result } from "@/model";

// 后端请求接口
const apiUrl: any = createUrl({
  page: "/serve/notify/page",
  push: "/serve/notify/push",
  end: "/serve/notify/end"
});

/**
 * 接口管理
 */
export const api: any = {
  /**
   * 分页查询
   * @param params 查询参数
   */
  page(params: object): Promise<PageResult> {
    return http.get<PageResult, any>(apiUrl.page, { params });
  },
  /**
   * 推送
   * @param data 表单内容
   */
  push(data: object) {
    return http.post<Result<any>, any>(apiUrl.push, { data });
  },
  /**
   * 关闭
   * @param data 表单内容
   */
  end(data: object) {
    return http.post<Result<any>, any>(apiUrl.end, { data });
  }
};
